"""
装饰器：不改变函数原有实现，给函数添加新功能

"""
import time


# def userinfo():
#     print(f"欢迎获取信息")

# def login_required(f):
#     def check():
#         name=input("亲输入姓名")
#         passwrod=input("请输入密码")
#         if name=='admin' and passwrod=='123456':
#             f()
#         else:
#             print("登录失败")
#     return check
#
# # userinfo=login_required(userinfo)
# # userinfo()
#
# @login_required
# def userinfo():
#     print(f"欢迎获取信息")
#
# userinfo()


# def fun(f):
#     def fun2():
#         i=input("请输入:")
#         if i=='1':
#             f()
#         if i!='1':
#             print("输入错误，无权限")
#     return fun2
def cost_time(f):
    def calc():
        stat=time.time()
        f()
        end=time.time()
        print(f.__name__,f"花费时间{end-stat}")
    return calc
@cost_time

def fun1():

    l=[i for i in range(1,1000)]
    for i in range(len(l)-1):
        for j in range(i+1,len(l)):
            if l[j] < l[i]:
                temp = l[i]
                l[i] = l[j]
                l[j] = temp
    print(l)
fun1()

